import * as types from '../actions/actionTypes';

const initialState = {
    username : '',
    password : '',
    loading : false,
    login : {},
};

let loginReducer = (state = initialState, action) => {

     switch(action.type)
     {
        case types.FETCH_LOGIN_INFO :
            return {
                 ...state,
            }
        case types.RECEIVE_LOGIN_INFO :
            return Object.assign({}, state, {
                username: action.login.username,
                password: action.login.password,
            })
        case types.CHECK_LOGIN :
            return Object.assign({}, state, {
                'loading' : action.loading,
            })
        case types.RECEIVE_LOGIN :
            return Object.assign({}, state, {
                'login' : action.login,
                'loading' : action.loading,
                'dlq' : '12345',
            })
         default : 
             return state;
     }
}

export default loginReducer;